package com.lineage.server;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

public class WriteLogTxt {
  private static Logger _log = Logger.getLogger(WriteLogTxt.class.getName());
  
  public static void Recording(String name, String info) {
    try {
      SimpleDateFormat sdfmt = new SimpleDateFormat("yyyy-MM-dd");
      Date d = Calendar.getInstance().getTime();
      String date = " " + sdfmt.format(d);
      String path = "玩家纪录/万物回收/时间" + date;
      File file = new File(path);
      if (!file.exists())
        file.mkdir(); 
      FileOutputStream fos = new FileOutputStream(String.valueOf(String.valueOf(path)) + "/" + name + date + ".txt", true);
      fos.write((String.valueOf(String.valueOf(info)) + " 时间：" + new Timestamp(System.currentTimeMillis()) + "\r\n").getBytes());
      fos.close();
    } catch (IOException e) {
      _log.log(Level.SEVERE, e.getLocalizedMessage(), e);
    } 
  }
}
